package com.ruoyi.product.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.product.mapper.CategoriesMapper;
import com.ruoyi.product.domain.Categories;
import com.ruoyi.product.service.ICategoriesService;

/**
 * 商品分类Service业务层处理
 *

 * @date 2023-07-19
 */
@Service
public class CategoriesServiceImpl implements ICategoriesService
{
    @Autowired
    private CategoriesMapper categoriesMapper;

    /**
     * 查询商品分类
     *
     * @param id 商品分类主键
     * @return 商品分类
     */
    @Override
    public Categories selectCategoriesById(Long id)
    {
        return categoriesMapper.selectCategoriesById(id);
    }

    /**
     * 查询商品分类列表
     *
     * @param categories 商品分类
     * @return 商品分类
     */
    @Override
    public List<Categories> selectCategoriesList(Categories categories)
    {
        return categoriesMapper.selectCategoriesList(categories);
    }

    /**
     * 新增商品分类
     *
     * @param categories 商品分类
     * @return 结果
     */
    @Override
    public int insertCategories(Categories categories)
    {
        categories.setCreateTime(DateUtils.getNowDate());
        return categoriesMapper.insertCategories(categories);
    }

    /**
     * 修改商品分类
     *
     * @param categories 商品分类
     * @return 结果
     */
    @Override
    public int updateCategories(Categories categories)
    {
        categories.setUpdateTime(DateUtils.getNowDate());
        return categoriesMapper.updateCategories(categories);
    }

    /**
     * 批量删除商品分类
     *
     * @param ids 需要删除的商品分类主键
     * @return 结果
     */
    @Override
    public int deleteCategoriesByIds(Long[] ids)
    {
        return categoriesMapper.deleteCategoriesByIds(ids);
    }

    /**
     * 删除商品分类信息
     *
     * @param id 商品分类主键
     * @return 结果
     */
    @Override
    public int deleteCategoriesById(Long id)
    {
        return categoriesMapper.deleteCategoriesById(id);
    }
}
